package com.djp.smartapp.dialog;

import android.view.View;
import android.widget.TextView;

import com.djp.smartapp.MainActivity;
import com.lenovo.manufacture.R;

public class UniversalDialog extends MyDialog{
    private TextView tvTitle;
    private TextView tvContent;

    protected UniversalDialog(MainActivity context) {
        super(context);
    }

    @Override
    protected int setAlertLayout() {
        return R.layout.dialog_universal;
    }

    @Override
    protected int setCancelButton() {
        return R.id.dialog_btn_cancel_universal;
    }

    @Override
    protected int setFinishButton() {
        return R.id.dialog_btn_finish_universal;
    }

    @Override
    protected void setFinishButtonOnClick() {
        alertDialog.dismiss();
    }

    @Override
    protected void initView(View view) {
        tvTitle = view.findViewById(R.id.dialog_tv_title_universal);
        tvContent = view.findViewById(R.id.dialog_tv_content_universal);
    }

    /**
     * 设置通用dialog的标题和内容
     * @param title 标题
     * @param content 内容
     */
    public void setText(String title, String content) {
        tvTitle.setText(title+"");
        tvContent.setText(content+"");
    }
}
